package com.hl.qzzpbackend.common;


import com.hl.qzzpbackend.exception.ErrorCode;
import lombok.Data;

import java.io.Serializable;

/**
 * @Title: BaseResponse
 * @Author helong
 * @Package com.hl.picturebackend.common
 * @Date 2024/12/26 14:13
 * @description: 全局响应封装类
 */

@Data
public class BaseResponse<T> implements Serializable {

    private int code;

    private String message;

    private T data;

    public BaseResponse(int code,T data, String message) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public BaseResponse(int code, T data) {
        this(code, data,"");
    }

    public BaseResponse(ErrorCode errorCode) {
        this(errorCode.getCode(), null, errorCode.getMessage());
    }

}
